import React, { useState } from 'react'
import routes from './router/Index'
import { RouterProvider } from 'react-router-dom'
import { Button, ConfigProvider, Input, Space, theme as antdTeme } from 'antd';
function App() {
 const [theme,setTheme]=useState('light')
  return (
    <div>
       <ConfigProvider
    theme={{
      // 1. 单独使用暗色算法
      algorithm: theme=='dark'?antdTeme.darkAlgorithm:antdTeme.defaultAlgorithm,

      // 2. 组合使用暗色算法与紧凑算法
      // algorithm: [theme.darkAlgorithm, theme.compactAlgorithm],
    }}
  >
    <Space>
      <Button type="primary" onClick={()=>setTheme(theme=='dark'?'light':'dark')}>
        {theme=='dark'?'浅色':'黑色'}
      </Button>
    </Space>
      <RouterProvider router={routes}></RouterProvider>
  </ConfigProvider>
    
    </div>
  )
}

export default App
